'Requires XUI and JavaObject. Declare xui As XUI in the calling module.
Dim chart As UIHorizontalBarChart
chart.Initialize(Me, "Chart")
chart.AddToParent(Activity, 10dip, 10dip, 340dip, 300dip)
chart.setShowGrid(False)
chart.setShowXAxisValues(False) 'Hide the percentage axis labels.
chart.setAnimation(True, 700)
chart.setTextTitle("Monthly budget")
chart.setMaximum(100)
chart.setSuffix("%")
chart.setRoundedBars(True)
chart.setBarSpacing(8dip)
Dim labels As List = Array As String("Rent", "Food", "Travel")
Dim amounts As List = Array As Float(45.23, 33.92, 25.44)
Dim colors As List = Array As Int(0xFF56CFA1, 0xFF8D7AF5, 0xFFF7B13B)

If chart.SetDataAsPercent(labels, amounts, colors, 137.10, "$", "") = False Then Log("Invalid chart data")
'For another unit, pass numeric amounts and their matching total.
'chart.SetDataAsPercent(labels, Array As Float(4.2, 6.8, 2.1), colors, 13.1, "", " kg")
'chart.SetDataAsPercent(labels, Array As Float(40, 75, 90), colors, 100, "", " pts")
'Long-press data points or shapes to display their values.
$end$

